const common = require('./webpack.common')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const { merge } = require('webpack-merge')
const path = require('path')
module.exports = merge(common, {
  mode: 'production',
  devtool: false,
  plugins: [
    new CleanWebpackPlugin(), // 在每次成功重建后删除webpack的output.path目录中的所有文件（在此代表dist目录）
    new CopyWebpackPlugin({ // 将整个目录复制到构建目录。
      patterns: [
        {
          from: path.join(__dirname, '/public'),
          to: path.join(__dirname, '/dist/public')
        }
      ]
    })
  ]
})
